<template>
  <div>
    <el-main>
     <el-table :data="order" style="width: 100%">
        <el-table-column label="商品名称" prop="productName"></el-table-column>
        <el-table-column label="商品图片" prop="pic">
          <template slot-scope="props">
            <img :src="getPic(props.row.productPic)" alt style="width:100px ;height:100px" />
          </template>
        </el-table-column>
        <el-table-column label="数量" prop="count"></el-table-column>
        <el-table-column label="单价(元)" prop="price"></el-table-column>
        <el-table-column label="订单号" prop="currentId"></el-table-column>
      </el-table>
    </el-main>
    <el-footer>
      <el-button style="margin-top: 12px;" @click="next">下一步</el-button>
    </el-footer>
  </div>
</template>

<script>
export default {
  data() {
    return {
      order: [],
      amount:''
    };
  },
  computed:{
    shopIds:{
      get(){
        return this.$store.state.shopIds
      },
      set(){
        this.$store.state.shopIds=v
      }
    },

    payCount:{
        get(){
        return this.$store.state.payCount
      },
      set(v){
        this.$store.state.payCount=v
      }
    }
  },
   methods: {
     getPic(pic) {
      let path = "http://localhost:3000/images/" + pic;
      console.log(path);
      return path;
    },
    next() {
      this.$store.state.activeNum = 2;
      this.$router.push("/index/order/pay");

    }
  },
  created(){
    var orderId=sessionStorage.getItem('orderId')
     console.log('订单号'+orderId)

     this.$axios.get('http://localhost:3000/order/getOrders/'+orderId)
    .then(res=>{
      console.log(res.data.data)
      this.order=res.data.data
      this.amount=this.payCount
      console.log('amount='+this.amount)
    })
    .catch(err=>{
      console.log(err)
    })
  }
};
</script>

<style>
</style>